home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1995 August / macformat-027.iso / mac / Shareware City / Developers / Oberon⁄F / Form / Docu / Controllers (.txt) next >
Encoding:
Oberon Document  |  1994-06-07  |  5.1 KB  |  128 lines  |  [oODC/obnF]

  1. Documents.StdDocumentDesc
  2. Documents.DocumentDesc
  3. Containers.ViewDesc
  4. Views.ViewDesc
  5. Stores.StoreDesc
  6. Documents.ModelDesc
  7. Containers.ModelDesc
  8. Models.ModelDesc
  9. Stores.ElemDesc
  10. TextViews.StdViewDesc
  11. TextViews.ViewDesc
  12. TextModels.StdModelDesc
  13. TextModels.ModelDesc
  14. TextModels.AttributesDesc
  15. Geneva
  16. TextRulers.StdRulerDesc
  17. TextRulers.RulerDesc
  18. TextRulers.StdStyleDesc
  19. TextRulers.StyleDesc
  20. TextRulers.AttributesDesc
  21. Geneva
  22. Geneva
  23. 7.3 FormControllers
  24. DEFINITION FormControllers;
  25.     IMPORT Views, Controllers, Containers, FormModels, FormViews;
  26.     CONST noSelection = Containers.noSelection; noFocus = Containers.noFocus;
  27.     TYPE
  28.         Controller = POINTER TO ControllerDesc;
  29.         ControllerDesc = RECORD (Containers.ControllerDesc)
  30.             form-: FormModels.Model;
  31.             view-: FormViews.View;
  32.             PROCEDURE (c: Controller) Clone (): Controller;
  33.             PROCEDURE (c: Controller) ThisView (): FormViews.View;
  34.             PROCEDURE (c: Controller) Select (view: Views.View);
  35.             PROCEDURE (c: Controller) Deselect (view: Views.View);
  36.             PROCEDURE (c: Controller) IsSelected (view: Views.View): BOOLEAN;
  37.             PROCEDURE (c: Controller) GetSelection (): List;
  38.             PROCEDURE (c: Controller) SetSelection (l: List)
  39.         END;
  40.         Directory = POINTER TO DirectoryDesc;
  41.         DirectoryDesc = RECORD (Controllers.DirectoryDesc)
  42.             PROCEDURE (d: Directory) New (): Controller;
  43.             PROCEDURE (d: Directory) NewView (f: FormModels.Model; opts: SET): FormViews.View
  44.         END;
  45.         List = POINTER TO ListDesc;
  46.         ListDesc = RECORD
  47.             next: List;
  48.             view: Views.View
  49.         END;
  50.     VAR dir-, stdDir-: Directory;
  51.     PROCEDURE Focus (): Controller;
  52.     PROCEDURE Insert (c: Controller; view: Views.View; l, t, r, b: LONGINT);
  53.     PROCEDURE SetDir (d: Directory);
  54.     PROCEDURE Install;
  55. END FormControllers.
  56. FormControllers are standard controllers for FormViews.
  57. TYPE Controller
  58. Interface, Extension
  59. Standard controllers for form views.
  60. form-: FormModels.Model    form # NIL
  61. The controller's model.
  62. view-: FormViews.View    view # NIL & view.ThisModel() = form
  63. The controller's view.
  64. PROCEDURE (c: Controller) Clone (): Controller
  65. Default, Extension
  66. Result type is narrowed.
  67. PROCEDURE (c: Controller) Select (view: Views.View)
  68. Interface
  69. Adds a view to the current selection, if it isn't selected already.
  70. view in c.form    20
  71. ~(noSel IN c.opts)    21
  72. c.IsSelected(view)
  73. c.ThisFocus() = NIL
  74. PROCEDURE (c: Controller) Deselect (view: Views.View)
  75. Interface
  76. Removes a view from the current selection, if it is selected.
  77. view in c.form    20
  78. ~c.IsSelected(view)
  79. PROCEDURE (c: Controller) IsSelected (view: Views.View): BOOLEAN
  80. Interface
  81. Determines whether the given view is currently selected or not. NIL is not considered selected.
  82. view = NIL  OR  view in c.form    20
  83. PROCEDURE (c: Controller) GetSelection (): List
  84. Interface
  85. Returns the list of selected subviews.
  86. all views of the result list are in c.form
  87. PROCEDURE (c: Controller) SetSelection (l: List)
  88. Interface
  89. Removes the existing selection, and selects the subviews of l.
  90. all views of l are in c.form    20
  91. TYPE Directory
  92. Interface, Extension
  93. Directory for form view controllers.
  94. PROCEDURE (d: Directory) New (): Controller
  95. Interface, Extension
  96. Create and return a new form view controller.
  97. result # NIL
  98. result.init
  99. result.form = NIL
  100. result.view = NIL
  101. result.opts = {}
  102. PROCEDURE (d: Directory) NewView (m: FormModels.Model; opts: SET): FormViews.View
  103. Interface
  104. Create a new form view with a new controller for form m, and return the view.
  105. result # NIL    
  106. result.init
  107. result.ThisModel() = m
  108. result.ThisController() # NIL
  109. result.ThisController().opts = opts
  110. VAR dir-, stdDir-: Directory
  111. Controller directories.
  112. PROCEDURE Focus (): Controller
  113. Returns the focus controller, if the focus currently is a form view, otherwise it returns NIL.
  114. PROCEDURE Insert (c: Controller; view: Views.View; l, t, r, b: LONGINT)
  115. Inserts view into c's view at the position (l, t, r, b). If necessary, the position is slightly corrected (rounded) such that view's top-left corner comes to lie on the grid. The size of view is not changed, however.
  116. PROCEDURE SetDir (d: Directory)
  117. Set directory d.
  118. d # NIL    20
  119. dir = d
  120. PROCEDURE Install
  121. Used internally.
  122. TextControllers.StdCtrlDesc
  123. TextControllers.ControllerDesc
  124. Containers.ControllerDesc
  125. Controllers.ControllerDesc
  126. Geneva
  127. Documents.ControllerDesc
  128.